import  java.util.*;

public class one {
    public static void main(String[] args) {

        int a, idx = 0;
        Scanner scanner = new Scanner(System.in);
        a = scanner.nextInt();

        int[] b = new int[6];
        while (a != 0) {
            b[idx ++] = a % 10;
            a /= 10;
        }

        int l = 0, r = 5;
        while (l < r) {
            b[l] = (b[l] + 5) % 10;
            b[r] = (b[r] + 5) % 10;
            int t = b[l];
            b[l] = b[r];
            b[r] = t;
            l ++ ;
            r --;
        }

        for (int i = b.length - 1;i >= 0;i --) {
            System.out.print(b[i]);
        }
    }
}